package com.hsp.Demo_02_array;

public class Demo_01 {
    public static void main(String[] args) {
        /*
            数组入门
         */
        double[] weight = {3.0, 5.0, 1.0, 3.4, 2.0, 50.0};
        double totalWeight = 0.0;
        double avgWeight = 0.0;
        for(int i = 0; i < weight.length; i++){
            totalWeight += weight[i];
        }
        avgWeight = totalWeight / weight.length;
        System.out.println("总体重为：" + totalWeight);
        System.out.println("平均体重为：" + avgWeight);
    }
}
